import os.path

import yaml
class YamlUtil:
    def read_testcase_yaml(self,yaml_name):
        # with open('../data/'+yaml_name,mode='r',encoding='utf-8') as f:
        with open(os.path.dirname(os.path.dirname(__file__))+'/data/' + yaml_name, mode='r', encoding='utf-8') as f:
            value = yaml.load(stream=f,Loader=yaml.FullLoader)

        return value

    def write_yaml(self,yaml_name,data):
        with open(os.path.dirname(os.path.dirname(__file__))+'/data/' + yaml_name, mode='w', encoding='utf-8') as f:
            yaml.dump(data,stream=f,allow_unicode=True)
